﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jn698._45GWTool.Communication
{
    public class Enums
    {
        public enum LinkEnum
        {
            Login,
            Heart,
            Report,
        }

        public enum FramingEnum
        {
            Start=0x0000,
            Confirm=0x8000,
            End=0x4000,
            Middle=0xC000,
        }
        public static string GetBaud(int index)
        {
            switch (index)
            {
                case 0:
                    return "300bps";
                case 1:
                    return "600bps";
                case 2:
                    return "1200bps";
                case 3:
                    return "2400bps";
                case 4:
                    return "4800bps";
                case 5:
                    return "7200bps";
                case 6:
                    return "9600bps";
                case 7:
                    return "19200bps";
                case 8:
                    return "39400bps";
                case 9:
                    return "57600bps";
                case 10:
                    return "115200bps";
                default:
                    return "自适应";
            }
        }

        public static int GetBaudIndex(string baudstr)
        {
            switch (baudstr)
            {
                case "300bps":
                    return 0;
                case "600bps":
                    return 1;
                case "1200bps":
                    return 2;
                case "2400bps":
                    return 3;
                case "4800bps":
                    return 4;
                case "7200bps":
                    return 5;
                case "9600bps":
                    return 6;
                case "19200bps":
                    return 7;
                case "39400bps":
                    return 8;
                case "57600bps":
                    return 9;
                case "115200bps":
                    return 10;
                default:
                    return 0xFF;
            }
        }
        public static string GetAgreementType(int index)
        {
            switch (index)
            {
                case 0:
                    return "本部分";
                case 1:
                    return "DL/T 645-1997";
                case 2:
                    return "DL/T 645-2007";
                case 3:
                    return "DL/T 698.45";
                case 4:
                    return "CT/T 188-2004";
                default:
                    return "unKnown";
            }
        }

        public static string GetConnectType(int index)
        {
            switch (index)
            {
                case 0:
                    return "未知";
                case 1:
                    return "单相";
                case 2:
                    return "三相三线";
                case 3:
                    return "三相四线";
                default:
                    return "unKnown";
            }
        }

        public static string GetTIUnit(int index)
        {
            switch (index)
            {
                case 0:
                    return "秒";
                case 1:
                    return "分";
                case 2:
                    return "时";
                case 3:
                    return "日";
                case 4:
                    return "月";
                case 5:
                    return "年";
                default:
                    return "unKnown";
            }
        }

       
    }
}
